home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / e / ddmoduls.lha / dd_Modules / dd_libraries / dd_sharedlibs.e next >
Text File  |  1995-02-26  |  2KB  |  90 lines

  1. -> dd_sharedlibs.e
  2.  
  3. -> FOLD OPTS
  4. OPT MODULE
  5. OPT PREPROCESS
  6. -> ENDFOLD
  7. -> FOLD MODULES
  8. MODULE 'asl'
  9. MODULE 'amigaguide'
  10. MODULE 'utility'
  11. MODULE 'utility/tagitem'
  12.  
  13. MODULE '*dd_debugon'
  14. MODULE 'tools/debug'
  15.  
  16.  
  17. -> ENDFOLD
  18. -> FOLD CONSTS
  19. EXPORT ENUM
  20.   DDA_LIB_Dummy=TAG_USER,
  21.   DDA_LIB_LibraryList,
  22.   DDM_LIB_OpenLibrary
  23. -> ENDFOLD
  24. -> FOLD OBJECTS
  25. EXPORT OBJECT libentry
  26.   name:PTR TO CHAR
  27.   version
  28.   baseptr
  29. ENDOBJECT
  30.  
  31. EXPORT OBJECT sharedlibs PRIVATE
  32.   liblist:PTR TO entry
  33. ENDOBJECT
  34.  
  35. OBJECT entry
  36.   PTR TO libentry
  37. ENDOBJECT
  38.  
  39. EXPORT DEF libs:PTR TO sharedlibs
  40. -> ENDFOLD
  41.  
  42. EXPORT PROC new(tags:PTR TO tagitem) OF sharedlibs
  43.   DEF tag,entrynum,libentry:PTR TO libentry
  44.  
  45.   IF utilitybase:=OpenLibrary('utility.library',0)
  46.  
  47.     self.liblist:=GetTagData(DDA_LIB_LibraryList,NIL,tags)
  48.     self.liblist:=[['a',1,1],['b',2,2]]
  49.     IF self.liblist
  50.  
  51.       PrintF('self.liblist=\h\n',self.liblist)
  52.       PrintF('self.liblist[]=\h\n',self.liblist[])
  53.       PrintF('self.liblist[].name=\h\n',self.liblist[].name)
  54.  
  55.       PrintF('listlen=\d\n',ListLen(self.liblist))
  56.       FOR entrynum:=1 TO ListLen(self.liblist)
  57.         PrintF('\s\n',Long(self.liblist[entrynum].name))
  58.       ENDFOR
  59.  
  60.     ENDIF
  61.   ENDIF
  62. ENDPROC
  63.  
  64. /*
  65. EXPORT PROC do(method,message) OF sharedlibs
  66.   DEF entrynum=0,found=FALSE,libbase=NIL,success=FALSE,libentry:PTR TO libentry
  67.   SELECT method
  68.   CASE DDM_LIB_OpenLibrary
  69.     WHILE (entrynum<ListLen(self.liblist)) AND (found=FALSE)
  70.       libentry:=self.liblist[entrynum]
  71.       IF libentry.baseptr=message
  72.         found:=TRUE
  73.       ELSE
  74.         entrynum:=entrynum+1
  75.       ENDIF
  76.     ENDWHILE
  77.     IF found
  78.       IF libbase:=OpenLibrary(self.liblist.libentry[entrynum].name,self.liblist.libentry[entrynum].version)
  79.         PutLong(libbase,self.liblist.libentry[entrynum].baseptr)
  80.         success:=TRUE
  81.       ENDIF
  82.     ENDIF
  83.   DEFAULT
  84.     KPUTSTR('Unknown method requested\n')
  85.   ENDSELECT
  86. ENDPROC
  87. */
  88. -> ENDFOLD
  89.  
  90.